package com.cskaoyan.javase.oop2._1extends._8hidden._1basic;

/**
 * 属性的隐藏
 * @since 09:49
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Demo {

    public static void main(String[] args) {
        Animal a = new Cat(100, 200);
        System.out.println(a.age);

        Animal a2 = new Cat(200);
        System.out.println(a2.age);
    }

}

class Animal {
    int age = 18;

    {
        age = 29;
    }

    public Animal(int age) {
        this.age = age;
    }

    public Animal() {
    }
}

class Cat extends Animal {
    {
        age = 33;
    }

    int age = 30;

    public Cat(int age, int age1) {
        super(age);
        this.age = age1;
    }

    public Cat(int age) {
        this.age = age;
    }

    public void test(){
        System.out.println(super.age);
    }

}
